package com.example.day13;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Lenovo
 */
public class DateUtils {
    private DateUtils() {
    }
    public static String dateToString(Date date,String format){
        SimpleDateFormat sdf=new SimpleDateFormat(format);
        String str = sdf.format(date);
        return str;
    }
    public static Date stringToDate(String str, String format) throws ParseException {
        SimpleDateFormat sdf=new SimpleDateFormat(format);
        Date date = sdf.parse(str);
        return date;
    }
}
